<!-- menu trái -->
<div id="content-left">
	<?php 
		$uri_segment		= $this->uri->segment(2);
		
		if($_SESSION['admin_id'] == 1)
		{
			$uri_segment		= $this->uri->segment(2);
			$array_menu_2 		= $this->mod_lib->detail('admin_menu_2', array('controller'=>$uri_segment));
			$array_menu 		= $this->mod_lib->detail('admin_menu_3', array('controller'=>$uri_segment));
			$id_menu 			= $array_menu[0]["id"];
			$menu_admin_3		= $this->db->get_where('admin_menu_3', array('admin_menu_2'=>$id_menu))->result_array();			
			if(count($array_menu) == 1)
			{
				foreach ($array_menu as $arr)
				{
					$value 		 = $arr['admin_menu_2'];
				}
				$menu_admin_3	 = $this->db->get_where('admin_menu_3', array('admin_menu_2'=>$value))->result_array();
			}			
	?>
	<div class="menu-product">
	 	<div class="sidebar-top-product white">
			<div class="left"><?php echo $array_menu[0]['name']?></div>
			<div class="right bgmenu"><a href="#">&nbsp;</a></div>
			<div class="clear"></div>
		</div>
		<?php foreach ($menu_admin_3 as $m3){?>
			<div class="menu-child">
				<div class="menu-img-child">
					<?php if($uri_segment == $m3['link']) {?>
						<a class='colorchange' href="<?php echo base_url()?>back_end/<?php echo $m3['link']?>">
							<?php echo $m3['name']?>
						</a>
					<?php } else {?>
						<a href="<?php echo base_url()?>back_end/<?php echo $m3['link']?>">
							<?php echo $m3['name']?>
						</a>
					<?php }?>
				</div>
			</div>
		<?php  }?>
	</div>
	    
	<?php }else{
		$uri_segment		= $this->uri->segment(2);
		$array_menu_2 		= $this->mod_lib->detail('admin_menu_2', array('controller'=>$uri_segment));
		$array_menu 		= $this->mod_lib->detail('admin_menu_3', array('controller'=>$uri_segment));
		$id_menu 			= $array_menu[0]["id"];
		$menu_admin_3		= $this->db->get_where('admin_menu_3', array('admin_menu_2'=>$id_menu))->result_array();			
		if(count($array_menu) == 1)
		{
			foreach ($array_menu as $arr)
			{
				$value 		 = $arr['admin_menu_2'];
			}
			$menu_admin_3	 = $this->db->get_where('admin_menu_3', array('admin_menu_2'=>$value))->result_array();
		}
	?>		
	<div class="menu-product">
	 	<div class="sidebar-top-product white">
			<div class="left"><?php echo $array_menu[0]['name']?></div>
			<div class="right bgmenu"><a href="#">&nbsp;</a></div>
			<div class="clear"></div>
		</div>
		<?php 
			foreach ($menu_admin_3 as $m3)
			{
				$permiss = $this->db->get_where('admin_permiss', array('menu_admin_id_3' => $m3['id'], 'access' => 1, 'admin_id' => $_SESSION['admin_id']));
				if($permiss->num_rows() > 0){?>
					<div class="menu-child">
						<div class="menu-img-child">
							<?php if ($uri_segment == $m3['link']) {?>
								<a class="colorchange" href="<?php echo base_url()?>back_end/<?php echo $m3['link']?>">
									<?php echo $m3['name']?>
								</a>
							<?php } else {?>
								<a href="<?php echo base_url()?>back_end/<?php echo $m3['link']?>">
									<?php echo $m3['name']?>
								</a>
							<?php }?>
						</div>
					</div>			
				<?php }
			}
		?>
	</div>  
<?php }?>  
</div><!-- end  content-left -->